package com.eu.ebpm.engine.entity.runtime;

import java.util.Date;

import com.eu.ebpm.engine.entity.BaseEntity;
import com.eu.ebpm.engine.entity.deploy.Mission;
import com.eu.ebpm.engine.init.EbpmCache;
import com.eu.ebpm.engine.service.Task;

/**
 * 加索引字段executionId
 * 
 * @author 王晓华
 *
 */
public class TaskEntity extends BaseEntity implements Task {

	/**
	 * 基本参数
	 */
	private String name;

	private String desc;

	private String assignee;

	private Date assigneeTime;

	private Date createTime;

	private long executionId;

	private Long rootExecutionId;

	private long missionId;
	/**
	 * 基本参数
	 */

	private String remark;

	// 流程
	private Execution execution;

	public TaskEntity() {
	}

	public TaskEntity(String name, String desc, Date createTime, long executionId, Long rootExecutionId, long missionId) {
		this.initId();
		this.name = name;
		this.desc = desc;
		this.createTime = createTime;
		this.executionId = executionId;
		this.rootExecutionId = rootExecutionId;
		this.missionId = missionId;
	}

	public TaskEntity(String name, String desc, String assignee, Date assigneeTime, Date createTime, long executionId, Long rootExecutionId, long missionId) {
		this.initId();
		this.name = name;
		this.desc = desc;
		this.assignee = assignee;
		this.assigneeTime = assigneeTime;
		this.createTime = createTime;
		this.executionId = executionId;
		this.rootExecutionId = rootExecutionId;
		this.missionId = missionId;
	}

	public Execution getExecution() {
		return execution;
	}

	public void setExecution(Execution execution) {
		this.execution = execution;
	}

	public Date getAssigneeTime() {
		return assigneeTime;
	}

	public void setAssigneeTime(Date assigneeTime) {
		this.assigneeTime = assigneeTime;
	}

	public long getMissionId() {
		return missionId;
	}

	public void setMissionId(long missionId) {
		this.missionId = missionId;
	}

	public long getExecutionId() {
		return executionId;
	}

	public void setExecutionId(long executionId) {
		this.executionId = executionId;
	}

	public Long getRootExecutionId() {
		return rootExecutionId;
	}

	public void setRootExecutionId(Long rootExecutionId) {
		this.rootExecutionId = rootExecutionId;
	}

	public String getAssignee() {
		return assignee;
	}

	public void setAssignee(String assignee) {
		this.assignee = assignee;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Mission getMission() {
		return EbpmCache.getMission(this.missionId);
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public String toString() {
		return "TaskEntity [name=" + name + ", desc=" + desc + ", assignee=" + assignee + ", assigneeTime=" + assigneeTime + ", createTime=" + createTime + ", executionId=" + executionId
				+ ", rootExecutionId=" + rootExecutionId + ", missionId=" + missionId + ", remark=" + remark + ", execution=" + execution + "]";
	}

}
